#ifndef MAP_H
#define MAP_H

#include "Cell.h"
#include "FlagCell.h"
#include "WallCell.h"
#include "CellType.h"
#include <string>

//under reconstruction for improved flexibility

class Map
{
public:
	Map();
	Map(unsigned int newWidth, unsigned int newHeight, const std::string& newMapName);
	Map(const std::string& fileName);
	Map(const Map& rhs);
	~Map();

	unsigned int GetWidth() const;
	unsigned int GetHeight() const;
	const std::string& GetMapName() const;

	void SetMapName(const std::string& newMapName);

	void SaveToFile(const std::string& fileName);

	const Cell& operator()(unsigned int x, unsigned int y) const;

	void SetCellType(unsigned int x, unsigned int y, CellType cellType);


	void Print();



private:
	void Allocate();
	void Deallocate();
	void LoadFromFile(const std::string& fileName);
	void CopyCells(Cell** dst, Cell** src, unsigned int newWidth, unsigned int newHeight, unsigned int oldWidth, unsigned int oldHeight);


	std::string mapName;
	unsigned int width, height;
	
	Cell** map;
};

#endif //MAP_H